/*
 * Copyright (C) 2011 Terence Lin
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * 
 */

package com.example.android.chickylander;

import android.content.ComponentName;
import android.content.ServiceConnection;
import android.os.IBinder;

/*
 * Singleton class to own the Music Service 
 */
public class ServiceConnectionManager {
	private static ServiceConnectionManager instance;
	
	boolean mIsBound = false;
	MusicService mService;
	ServiceConnection Sconn = new ServiceConnection(){

		public void onServiceConnected(ComponentName name, IBinder binder) {
			mService = ((MusicService.ServiceBinder) binder).getService();
		}

		public void onServiceDisconnected(ComponentName name) {
			mService = null;
		}
	};
	
    private ServiceConnectionManager() {  }
    
    public static synchronized ServiceConnectionManager getInstance() {
            if (null == instance) {
                    instance = new ServiceConnectionManager();
            }
            return instance;
    }
}
